//
//  HttpAssortPtl.m
//  Cat
//
//  Created by lushitong on 2018/12/19.
//  Copyright © 2018年 lushitong. All rights reserved.
//

#import "HttpAssortPtl.h"
#import "FLRequest.h"
#import "FLTool.h"

#define API_Category @"category/list"
#define API_Product @"category/product/list"

@implementation HttpAssortPtl

+ (void)getCategoryListWithSuccuss:(FLSuccess)success failure:(FLFailure)failure {
	[FLRequest GET:[FLTool getFullPath:API_Category] parameters:@{} success:success failure:failure];
}

+ (void)getCategoryListWithProductListWithCategoryID:(NSNumber *)categoryID WithSuccuss:(FLSuccess)success failure:(FLFailure)failure {
	NSDictionary *params = @{@"parentId": categoryID ? categoryID :@(0)};
	[FLRequest GET:[FLTool getFullPath:API_Category] parameters:params success:success failure:failure];
}

+ (void)getCategoryProductListWithCategoryID:(NSNumber *)categoryID andPageIndex:(NSNumber *)pageIndex andSortType:(NSString *)sortType withSuccuss:(FLSuccess)success failure:(FLFailure)failure {
	NSDictionary *params = @{@"categoryId": categoryID ? categoryID :@(0),
							 @"index":pageIndex ? pageIndex : @(0),
							 @"size": @"20",
							 @"rankType":sortType};
	[FLRequest GET:[FLTool getFullPath:API_Product] parameters:params success:success failure:failure];
}

@end
